/***************************************************
> Copyright (C) 2024 ==KINGYI== All rights reserved.
> File Name:client.c
> Author:xxx
> Mail: 
> Created Time: 2024年12月04日 星期三 11时14分47秒
***************************************************/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include "login.h"
#include "cJSON.h"

int main(int argc,const char* argv[])
{
	//创建通信套接字
	int client_socket = socket(AF_INET,SOCK_STREAM,0);
	struct sockaddr_in caddr;
	caddr.sin_family = AF_INET;
	caddr.sin_port = htons(6666);
	caddr.sin_addr.s_addr = inet_addr("192.168.0.195");
	//向服务端请求连接
	connect(client_socket,(struct sockaddr *)&caddr,sizeof(caddr));
	int chose = 0;
	int chose_1;
	int num = 0;
	do{
		printf("康神养老管理系统\n");
		printf("1、管理员登陆\n");
		printf("2、员工登陆\n");
		printf("3、家属登陆\n");
		printf("4、退出\n");
		printf("input:");
		scanf("%d",&chose);
		switch(chose){
			case 1:
				num = gly_login(client_socket);
				if(num == 1){
					printf("登陆成功\n");
				}else{
					printf("登陆失败,请重新选择\n");
					continue;
				}
				do{
					printf("1、护工注册\n");
					printf("2、家属注册\n");
					printf("3、离职人员删除\n");
					printf("4、查看用户信息\n");
					printf("5、返回上一级\n");
					printf("input:");
					scanf("%d",&chose_1);
					switch(chose_1){
						case 1:
							
							break;
						case 2:
							num = family_register(client_socket);
							if(num == 1){
								printf("注册成功\n");
							}else{
								printf("注册失败,请重新选择\n");
								continue;
							}
							break;
						case 3:
							
							break;
					}
				}while(chose_1 != 5);
				break;
			case 2:
				do{
					printf("1、登记老人档案\n");
					printf("2、删除老人档案\n");
					printf("3、生成费用\n");
					printf("4、查看老人的健康情况\n");
					printf("5、请假申请\n");
					printf("6、查看请假审批状态\n");
					printf("7、返回上一级\n");
					printf("input:");
					int chose_1;
					scanf("%d",&chose_1);
					switch(chose_1){
						case 1:
							
							break;
						case 2:
							
							break;
						case 3:
							
							break;
						case 4:
							
							break;
						case 5:
							
							break;
						case 6:
							
							break;
						case 7:
							
							break;
					}
				}while(chose_1 != 7);
				break;
			case 3:
				do{
					printf("1、查看老人的健康情况\n");
					printf("2、查看缴费情况\n");
					printf("3、查看用户信息\n");
					printf("4、返回上一级\n");
					printf("input:");
					int chose_1;
					scanf("%d",&chose_1);
					switch(chose_1){
						case 1:
							
							break;
						case 2:
							
							break;
						case 3:
							
							break;
					}
				}while(chose_1 != 4);
				break;
		}
	}while(chose != 4);
	
	close(client_socket);
    return 0;
}
